<template>
    <div>
        <head-top></head-top>
        <table border="1">
            <caption>个人详细资料</caption>
            <tr>
                <td class="odd">姓名</td>
                <td class="eve">李嘉诚</td>
                <td rowspan="5"><img src="../assets/img/li.jpg" class="lijiacheng"></td>
            </tr>
            <tr>
                <td class="odd">性别</td>
                <td class="eve">男</td>

            </tr>
            <tr>
                <td class="odd">民族</td>
                <td class="eve">汉族</td>

            </tr>
            <tr>
                <td class="odd">出生年月</td>
                <td class="eve">1928年7月29日</td>

            </tr>
            <tr>
                <td class="odd">身份证号</td>
                <td class="eve">44158119287292325</td>

            </tr>
            <tr>
                <td class="odd">籍贯</td>
                <td colspan="2" class="eve">福建 莆田</td>

            </tr>
            <tr>
                <td class="odd">户籍地址</td>
                <td colspan="2" class="eve">福建 莆田</td>

            </tr>
            <tr>
                <td class="odd">出生地</td>
                <td colspan="2" class="eve">广东潮州潮安县</td>

            </tr>
            <tr>
                <td class="odd">住址</td>
                <td colspan="2" class="eve">香港九龙长沙湾道28号2f13座</td>

            </tr>
            <tr>
                <td class="odd">联系方式</td>
                <td colspan="2" class="eve">13580115956</td>

            </tr>
        </table>
    </div>
</template>

<script>
	import headTop from '../components/headTop'
	import tendency from '../components/tendency'
	import dtime from 'time-formater'
	import {userCount, orderCount, getUserCount, getOrderCount, adminDayCount, adminCount} from '@/api/getData'
    export default {
    	data(){
    		return {
    			userCount: null,
    			orderCount: null,
                adminCount: null,
                allUserCount: null,
                allOrderCount: null,
                allAdminCount: null,
    			sevenDay: [],
    			sevenDate: [[],[],[]],
                img:"../assets/img/gongshang.png"
    		}
    	},
        created:function () {
            // let img = this.$router.query.img;
            // console.log("img:",img);
            console.log("img____________")
            console.log(this.img)
            if(!this.$router.query){
                this.img = "../assert/gongshang.png";
                console.log("assert______________________--")
                console.log(this.img)
            }else{
                this.img = img;
            }
        },
    	components: {
    		headTop,
    		tendency,
    	},
    	mounted(){
    		this.initData();
    		for (let i = 6; i > -1; i--) {
    			const date = dtime(new Date().getTime() - 86400000*i).format('YYYY-MM-DD')
    			this.sevenDay.push(date)
    		}
    		this.getSevenData();
    	},
        computed: {

        },
    	methods: {
    		async initData(){
    			const today = dtime().format('YYYY-MM-DD');
    			Promise.all([userCount(today), orderCount(today), adminDayCount(today), getUserCount(), getOrderCount(), adminCount()])
    			.then(res => {
    				this.userCount = res[0].count;
    				this.orderCount = res[1].count;
                    this.adminCount = res[2].count;
                    this.allUserCount = res[3].count;
                    this.allOrderCount = res[4].count;
                    this.allAdminCount = res[5].count;
    			}).catch(err => {
    				console.log(err)
    			})
    		},
    		async getSevenData(){
    			const apiArr = [[],[],[]];
    			this.sevenDay.forEach(item => {
    				apiArr[0].push(userCount(item))
    				apiArr[1].push(orderCount(item))
                    apiArr[2].push(adminDayCount(item))
    			})
    			const promiseArr = [...apiArr[0], ...apiArr[1], ...apiArr[2]]
    			Promise.all(promiseArr).then(res => {
    				const resArr = [[],[],[]];
					res.forEach((item, index) => {
						if (item.status == 1) {
							resArr[Math.floor(index/7)].push(item.count)
						}
					})
					this.sevenDate = resArr;
    			}).catch(err => {
    				console.log(err)
    			})
    		}
    	}
    }
</script>

<style scoped>
    .all{ margin: 0 auto; width: 1000px;}
    .header {  width: 1000px; margin: 0 auto; margin-top: 30px;margin-left: 70px;}
    .txt{ width:750px; margin: 0  auto; height: 40px;}
    .saosuo{width: 50px; height:48px;margin-left: -5px; margin-bottom: -19px;}
    .check{margin-left: 30px; margin-top: 40px;  margin-bottom: 30px;}
    ul{list-style-type: none; float: left;}
    li{float: left; display:block; margin-left: 35px; font-size: 18px;}
    ul li span{color: darkgray;}
    li:hover{color: #128bed; cursor: pointer;}
    .content{ width: 850px; height: 400px;   margin-left: -30px; margin-top: 115PX;}
    .number{color: red;}
    .even{height:50px; width: 10px;}
    .oddd{padding-top: 12px; padding-left: 30px; padding-bottom: 10px; }
    .result{margin-left:80px; font-size: 20px;}
    .boy{width: 60px; height: 70px; padding-left: 20px;  padding-right: 20px;}
    .Li{color: red; font-size: 21px;}
    .bottom{margin-left: 0px; width: 1000px; height: 60px; margin-top: px;}
    a{text-decoration: none;}
    .table1{width:1050px;border-collapse:collapse;border-spacing:1;border-spacing:0;  margin: 0 auto;}
    table td{word-break: break-all; word-wrap:break-word;border-right:1px solid #0099ff;
        border-bottom:1px solid #0099ff;
        vertical-align: middle;
        border-top:1px solid #404040;
        border-left: 1px solid #404040;;
    }
    /*#404040*/
    /*table td{
   padding-left: 35px;
  height: 40px;
  width: 110px;

   }*/
    table{width:750px;border-collapse:collapse;border-spacing:1;border-spacing:0;  margin: 0 auto 20px;}
    .odd{ width: 150px; padding-left: -20px; height: 40px; background: #d8d5d5; text-align:center ; font-weight: 550;}
    .eve{padding-left: 50px; width: 200px;}
    caption{text-align: center;  font-size: 26px; margin-bottom: 35px; font-weight: bold; margin-top: 15px;}
    .lijiacheng{width: 200px; height: 250px; margin-left: 70PX;}

</style>
<style lang="less" scoped>
	@import '../style/mixin';


    .data_section{
		padding: 20px;
		margin-bottom: 40px;
		.section_title{
			text-align: center;
			font-size: 30px;
			margin-bottom: 10px;
		}
		.data_list{
			text-align: center;
			font-size: 14px;
			color: #666;
            border-radius: 6px;
            background: #E5E9F2;
            .data_num{
                color: #333;
                font-size: 26px;

            }
            .head{
                border-radius: 6px;
                font-size: 22px;
                padding: 4px 0;
                color: #fff;
                display: inline-block;
            }
        }
        .today_head{
            background: #FF9800;
        }
        .all_head{
            background: #20A0FF;
        }
	}
    .wan{
        .sc(16px, #333)
    }
</style>
